﻿<phone:PhoneApplicationPage 
    x:Class="WP7FlacPlayer.View.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    shell:SystemTray.Opacity="0"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:MyControls="clr-namespace:WP7FlacPlayer.Controls"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:ProgressBar="clr-namespace:CJToolkit.ProgressBar;assembly=CJToolkit"
    xmlns:pi="clr-namespace:Microsoft.Practices.Prism.Interactivity;assembly=Microsoft.Practices.Prism.Interactivity"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
    <phone:PhoneApplicationPage.DataContext>
        <Binding Path="MainPageViewModel" Source="{StaticResource ViewModelLocator}"/>
    </phone:PhoneApplicationPage.DataContext>
    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <controls:Panorama x:Name="ControlPanel">
        <controls:Panorama.Title>
            <TextBlock FontSize="100" Margin="12,100,0,-20">Flac Player</TextBlock>
        </controls:Panorama.Title>
        <controls:PanoramaItem Header="播放列表" Orientation="Horizontal">
            <Grid>
                <!--以后使用longlistselector-->
                <MyControls:AnimedListBox x:Name="PlayList" ItemsSource="{Binding Path=PlayList}">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <ListBoxItem Margin="0,6" toolkit:TiltEffect.IsTiltEnabled="True">
                                <ListBoxItem.Background>
                                    <SolidColorBrush Color="{StaticResource PhoneForegroundColor}" Opacity="0.2"/>
                                </ListBoxItem.Background>
                                <Grid Margin="6" Width="600">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="Auto"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <!--图片-->
                                    <Grid Grid.Column="0" Margin="2">
                                        <Image Grid.Row="0" Source="{Binding Path=Image}" Stretch="UniformToFill" Width="120" Height="120"/>
                                    </Grid>
                                    <!--其他信息-->
                                    <StackPanel Grid.Column="1" Margin="6,2">
                                        <TextBlock Text="{Binding Path=SongInfo.Title}" FontSize="32" TextTrimming="WordEllipsis"/>
                                        <TextBlock Text="{Binding Path=SongInfo.Album}" FontSize="24" TextTrimming="WordEllipsis"/>
                                        <TextBlock Text="{Binding Path=SongInfo.Artist}" FontSize="20" TextTrimming="WordEllipsis"/>
                                        <TextBlock Text="{Binding Path=SongInfo.Genre}" FontSize="16" TextTrimming="WordEllipsis"/>
                                    </StackPanel>
                                </Grid>
                            </ListBoxItem>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </MyControls:AnimedListBox>
            </Grid>
        </controls:PanoramaItem>
        <controls:PanoramaItem Header="当前播放">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="3*"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0">
                    <Image Source="{Binding Path=CurrentItem.Image}" Stretch="Uniform"/>
                </Grid>
                <Grid Grid.Row="1">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                    </Grid.ColumnDefinitions>
                    <CheckBox Grid.Column="0" Content="随机播放" IsChecked="{Binding Path=ShuffleOn,Mode=TwoWay}"/>
                    <CheckBox Grid.Column="1" Content="单曲播放" IsChecked="{Binding Path=SingleOn,Mode=TwoWay}"/>
                </Grid>
                <Grid Grid.Row="2" Margin="0,6">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid Grid.Column="0" Width="100" Height="100">
                        <ProgressBar:CircleProgressBar Visibility="{Binding Path=ProgressBarVisibility}" IsLooping="{Binding Path=OnLoading}" FillRate="{Binding Path=PlayedRate}" ArcForeground="{StaticResource PhoneAccentBrush}">
                            <ProgressBar:CircleProgressBar.ArcBackground>
                                <SolidColorBrush Color="{StaticResource PhoneForegroundColor}" Opacity="0.3"/>
                            </ProgressBar:CircleProgressBar.ArcBackground>
                        </ProgressBar:CircleProgressBar>
                    </Grid>
                    <StackPanel Grid.Column="1" Margin="6,2">
                        <TextBlock Text="{Binding Path=CurrentItem.SongInfo.Title}" FontSize="28" TextTrimming="WordEllipsis" TextAlignment="Right"/>
                        <TextBlock Text="{Binding Path=CurrentItem.SongInfo.Album}" FontSize="24" TextTrimming="WordEllipsis" TextAlignment="Right"/>
                        <TextBlock Text="{Binding Path=CurrentItem.SongInfo.Artist}" FontSize="18" TextTrimming="WordEllipsis" TextAlignment="Right"/>
                    </StackPanel>
                </Grid>
            </Grid>
        </controls:PanoramaItem>
    </controls:Panorama>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="False" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/icons/Dark/Pre.png" Text="上一首" />
            <shell:ApplicationBarIconButton IconUri="/icons/Dark/Play.png" Text="播放" />
            <shell:ApplicationBarIconButton IconUri="/icons/Dark/Pause.png" Text="暂停" />
            <shell:ApplicationBarIconButton IconUri="/icons/Dark/Next.png" Text="下一首" />
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="SkyDrive下载" Click="SkyDriveClick"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <i:Interaction.Behaviors>
        <pi:ApplicationBarButtonCommand ButtonText="上一首" CommandBinding="{Binding Path=PreCommand}"/>
        <pi:ApplicationBarButtonCommand ButtonText="播放" CommandBinding="{Binding Path=PlayCommand}"/>
        <pi:ApplicationBarButtonCommand ButtonText="暂停" CommandBinding="{Binding Path=PauseCommand}"/>
        <pi:ApplicationBarButtonCommand ButtonText="下一首" CommandBinding="{Binding Path=NextCommand}"/>
    </i:Interaction.Behaviors>
</phone:PhoneApplicationPage>